package qj.tool.gae;

import com.google.appengine.api.xmpp.*;

public class XmppUtil {

	public static boolean send(String addr, String msgBody) {
		JID jid = new JID(addr);
		Message msg = new MessageBuilder()
		    .withRecipientJids(jid)
		    .withBody(msgBody)
		    .build();
	
		XMPPService xmpp = XMPPServiceFactory.getXMPPService();
	    SendResponse status = 
		xmpp.sendMessage(msg);
	    boolean messageSent = (status.getStatusMap().get(jid) == SendResponse.Status.SUCCESS);
	    return messageSent;
	}

}
